<?php

namespace app\common\model;

/**
 * [Practice  修行表]
 * @author [C。]
 * @return html
 */
class PracticeLog extends Base
{
    protected $name = 'practice_log';
    /**
     * 根据搜索条件获取列表信息
     */
    public function getList($map, $from=0, $size = 5,$field)
    {
        $order = ['pl.id' => 'desc'];
        $join = [
            ['app_practice p','p.id = pl.pid'],
        ];
        $result = $this->field($field)
            ->alias('pl')
            ->join($join)
            ->where($map)
            ->limit($from, $size)
            ->order($order)
            ->select();

        return $result;
    }

    /**
     * 根据条件来获取列表的数据的总数
     * @param array $param
     */
    public function getCount($map = []) {
        $join = [
            ['app_practice p','p.id = pl.pid'],
        ];
        return $this->alias('pl')->join($join)->where($map)->count();
    }
}